<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 
	import="java.util.*, javax.ejb.*, javax.naming.*, com.tiger.ebenv.sample3.*" %>
<html>
<head><title>Stock Prices</title></head>
<body>
<%
    //request.setCharacterEncoding("JISAutoDetect");
    
    InitialContext ctx = new InitialContext();
    StockPriceReaderHome stockPriceReaderHome = 
        (StockPriceReaderHome)ctx.lookup("comp/env/ejb/StockPriceReaderBean");
    StockPriceReader stockPriceReader = stockPriceReaderHome.create();
    StockPrices stockPrices =stockPriceReader.getStockPrices();
    Iterator iterator = stockPrices.getCompanies().iterator();
%> 
<table border="1">
  <tr> 
    <td>企業名</td>
    <td>株価</td>
  </tr>
<%
    while(iterator.hasNext()) {
        String company = (String)iterator.next();
        double price = stockPrices.getPrice(company);
%> 
  <tr>
    <td><%=company %></td>
    <td><%=price %></td>
  </tr>
<%
    }
%>
</table>
</body>
</html>
